
import * as qiniu from 'qiniu-js'

const key = null

const config = {
    useCdnDomain: true,
    region: qiniu.region.cnEast2,
    forceDirect: true
}

export const qiniuUploadImage = (file: File, token: string) => {

    const putExtra: any = {
        fname: file.name,
        mimeType: 'image/*'
    }

    return qiniu.upload(file as File, key, token, putExtra, config)

}

export const qiniuUploadVideo = (file: File, token: string) => {

    const putExtra: any = {
        fname: file.name,
        mimeType: 'video/*'
    }

    return qiniu.upload(file as File, key, token, putExtra, config)

}